#ifndef DYN_QUAD_QGAUSS_H
#define DYN_QUAD_QGAUSS_H

#include <armadillo>

#include "dyn_quad.h"

using namespace arma;

/*! \author Joey Dumont <joey.dumont@gmail.com>
 *
 *  \date 2012-10-05
 *
 *  \brief Abstract class for Gauss quadrature.
 *
 * We define an abstract class to evaluate
 * integrals of the form
 *  \f[
 *  \int_{-1}^1 f(x)dx = \sum_{j=0}^{N-1} w_jf(x_j).
 * \f]
 * This particular form is called {\em Gaussian quadrature}.
 * The abscissas are given by the zeros of the Legendre polynomials
 * of order \f$N\f$.
 */

class qGauss : public Quad
{
public:
    /*! Constructor defines the function to be
     * integrated and the integration boundaries. */
    qGauss(Functor& _func,
           double _a,
           double _b)
        : Quad(_func,_a,_b){}

    /*! Re-declared pure virtual function. */
    double doQuadrature();

    /*! Populate the weight and abscissas vectors. */
    virtual void populateVectors() = 0;

protected:
    /*! @name Abscissas and Weights */
    //@{
    colvec abscissas;
    colvec weights;
    //@}
};

#endif // DYN_QUAD_QGAUSS_H
